<template>
	<view class="pageBox">
		<view class="addressList">
			<view class="item" v-for="(item,index) in addressList" :key="index">
				<view class="left">
					<view class="title">
						{{item.provinceName}} {{item.cityName}} {{item.countyName}}
					</view>
					<view class="cen">
						{{item.detailInfo}}
					</view>
					<view class="foot">
						{{item.userName}}  {{item.telNumber}}
					</view>
				</view>
				<image src="https://imgs.ynz666.com/2025/05/15/M2ZhYzYwYmU0ZTNhMjBhMWI3YjQ5NTE0Zjk5ZTNjZmM=.png" mode="aspectFill" class="right" @click="editAddress(item)"></image>
			</view>
		</view>
		
		<!-- <view class="foot_btn" @click="openPage('address',2)">
			新增地址
		</view> -->
		<view class="foot_fixed">
			<view class="foot_box">
				<view class="pir">
				<view class="right">
					<view class="btn" @click="openPage('address',2)">添加地址</view>
				</view>	
				</view>
			</view>	
		</view>
	</view>
</template>

<script>
	import {
		receiverAddressList,
	} from '../../apis/my.js';
	export default {
		data() {
			return {
				addressList:[]
			}
		},
		onShow() {
			this.receiverAddress();
			
		},
		methods: {
			receiverAddress(){
				let data={
					page:1,
					pageSize:20
				}
				receiverAddressList(data).then(res=>{
					this.addressList=res.data.list
				})
			},
			editAddress(item){
				uni.navigateTo({
					url: `/pageB/address/address?info=${JSON.stringify(item)}`
				})
			},
			openPage(page, index) {
				switch (index) {
					case 1:
						uni.navigateTo({
							url: `/pages/${page}/${page}`
						})
						break;
					case 2:
						uni.navigateTo({
							url: `/pageB/${page}/${page}`
						})
						break;
					case 3:
						uni.navigateTo({
							url: `/pageC/${page}/${page}`
						})
						break;
					case 4:
							uni.navigateTo({
								url: `/pageD/${page}/${page}`
							})
							break;
					default:
						break;
				}
			
			},
		}
	}
</script>

<style lang="scss">
page {
		background: #f9f9f9;
	}
	.pageBox {
		width: 100%;
		padding-bottom: 200rpx;
		.addressList{
			width: 100%;
			background: #fff;
			.item{
				display: flex;
				align-items: center;
				padding: 36rpx;
				.left{
					flex: 1;
					.title{
						font-weight: 400;
						font-size: 22rpx;
						color: #727272;
					}
					.cen{
						font-weight: 500;
						font-size: 28rpx;
						color: #0B0B0B;
						padding: 8rpx 0 12rpx;
					}
					.foot{
						font-weight: 400;
						font-size: 24rpx;
						color: #0B0B0B;
					}
				}
				.right{
					width: 38rpx;
					height: 38rpx;
				}
			}
		}
		.foot_btn{
			width: 678rpx;
			height: 92rpx;
			background: linear-gradient( 270deg, #FFAF40 0%, #FF5C04 100%);
			border-radius: 40rpx 40rpx 40rpx 40rpx;
			font-weight: bold;
			font-size: 36rpx;
			color: #FFFFFF;
			display: flex;
			align-items: center;
			justify-content: center;
			margin: 36rpx 0 0 36rpx;
		}
		.foot_fixed{
			height: 92rpx;
			width: 100%;
			position: fixed;
			bottom: 40rpx;
			z-index: 99;
			.foot_box{
				margin: 0 36rpx;
				height: 92rpx;
				// background: #fff;
				box-shadow: 0px 0px 20px rgba(162, 39, 0, 0.4);
				border-radius: 40rpx;
				display: flex;
				align-items: center;
				.pir{
					width: 100%;
					height: 100%;
					display: flex;
					align-items: center;
				}
				.right{
					width: 100%;
					height: 100%;
					background: linear-gradient( 270deg, #FFAF40 0%, #FF5C04 100%);
					color: #FFFFFF;
					font-size: 36rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					border-radius: 40rpx;
					position: relative;
					.btn{
						width: 100%;
						height: 100%;
						display: flex;
						align-items: center;
						justify-content: center;
					}
					button{
						    width: 100%;
						    height: 100%;
						    position: absolute;
						    top: 0;
						    left: 0;
						    opacity: 0;
					}
				}
			}
		}
	}
</style>
